<template>
  <div class="">
    <input type="text" ref="inputRef" />
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'

// 创建并且关联上ref
const inputRef = ref()

onMounted(() => {
  console.log(inputRef.value)
  inputRef.value.focus()
})
</script>

<style scoped></style>
